package com.kelvem.saas.workbanch.ontology.order.handle.create;

import com.kelvem.saas.workbanch.fsm.anno.handle.RegisterHandle;
import com.kelvem.saas.workbanch.fsm.entity.Entity;
import com.kelvem.saas.workbanch.fsm.core.EventContext;
import com.kelvem.saas.workbanch.fsm.handle.Handle;
import com.kelvem.saas.workbanch.ontology.order.model.OrdersEntity;
import com.kelvem.saas.workbanch.ontology.risk.BlacklistEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author kelvem
 */
@Service
@Slf4j
public class CheckBlackListHandle extends Handle {
    
    @Override
    @RegisterHandle(entityClass={OrdersEntity.class, BlacklistEntity.class})
    public void execute() {
    
        OrdersEntity order = Entity.instance().selectOne(OrdersEntity.class);
        BlacklistEntity blacklist = order.selectOne(BlacklistEntity.class);
        
        log.info("Handle[" + getName() + "] blacklist=" + blacklist);
        
        if (blacklist == null) {
            return;
        }
        log.info("处理blacklist逻辑, 如果在白名单抛异常");
    
        EventContext.print();
    }
}
